#include "GenericMessage.h"


GenericMessage::GenericMessage(MessageType _type, BYTE* _buff)
	:PipeMessage( _type )
{
	if(_buff)
	{
		mBuffer = _buff;
		ParseBuffer();
	}
}


UINT GenericMessage::CreateBuffer( UINT _startPos /*= 0*/ )
{
	memcpy_s(mBuffer + _startPos, sizeof(int), &mResult, sizeof(int));
	return _startPos + sizeof(int);
}

void GenericMessage::ParseBuffer()
{
	memcpy_s(&mResult, sizeof(int), mBuffer + sizeof(MessageType), sizeof(int));
}

UINT GenericMessage::GetBufferSize()
{
	return sizeof(int);
}

void GenericMessage::SetResult( int _res )
{
	mResult = _res;
	mBufferChanged = true;
}
